<?php
    if($unlimited==1&&!CzyAdmin($_SESSION['user'])) {
        print("Nie probuj...<br>\n");
        HtmlFooter();
        exit;
    }
    print("<h1 align=\"center\">Ranking</h1>\n");
    print("(wygenerowany: ".Data().")\n");
    if($unlimited==1) $franking=fopen($rootdir."ranking_icm_admins.txt", "r");
    else $franking=fopen($rootdir."ranking_icm.txt", "r");
    print("<table border=0 cellpadding=5 cellspacing=1 bgcolor=\"#707070\">\n");
    print("<tr bgcolor=\"#A0A0A0\"><th>Poz.</th><th>Nick</th><th>Punkty</th><th>Czas</th><th>Zrobione zadania</th></tr>\n");
    $i=0;
    while(!feof($franking))
    {
        $nick=fgets($franking);
        $points=fgets($franking);
        $time=fgets($franking);
        $tasks=fgets($franking);
        if(CzyAdmin(substr($nick,0,strlen($nick)-1))) continue;
        if($points=="0\n") $tasks="&#151;";
        if($tasks=="") continue;
        $i++;
        print("<tr bgcolor=\"#E0E0E0\" align=center>\n");
        print("<td><b>".rtrim($i)."</b></td><td>".rtrim($nick)."</td><td>".rtrim($points)."</td><td>".rtrim($time)."</td><td>".rtrim($tasks)."</td>\n");
        print("</tr>\n");
    }
    print("</table>\n");
    print("<br>\n");
?>
